<template>
  <div>
    <h2>首页</h2>
    <router-link to="/home/news">fuckin</router-link>
    <router-link to="/home/message">slave</router-link>



    <router-view></router-view>


  </div>
</template>

<script>
export default {
  name: "home",
  data(){
    return{path:'/home/news'}
  },
  //只有keep-alive时才用用
  activated(){
    this.$router.push(this.path)
    console.log('activated');
  },
  deactivated(){
    console.log('deactivated');

  },
  beforeRouteLeave(to,from,next){
    this.path=this.$route.path;
    console.log(this.path);
    next()
  }
}
</script>

<style scoped>

</style>